package odgs.app.server;

import java.util.ArrayList;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.title.LegendTitle;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.data.general.PieDataset;

/**
 *
 * @author  user
 */
public class StateGraphUI extends javax.swing.JPanel {
    
    private String title;
	private DefaultPieDataset data;
	private ChartPanel chartPanel;

	/** Creates new form GridNodeGraphUI */
    public StateGraphUI(String title) {
    	this.title = title;
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
    private void initComponents() {
        setLayout(new java.awt.BorderLayout());
    	data = new DefaultPieDataset();
		JFreeChart chart = ChartFactory.createPieChart("", data, true, true, true);
		chartPanel = new ChartPanel(chart);
        setBorder(javax.swing.BorderFactory.createTitledBorder(null, title, javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 0, 11), new java.awt.Color(0, 0, 0)));
        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(chartPanel);
		chartPanel.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 262, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 359, Short.MAX_VALUE)
        );
        
        add(chartPanel, java.awt.BorderLayout.CENTER);

    }// </editor-fold>
    
    public DefaultPieDataset getData()
    {
    	return data;
    }
    
}
